﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace zichan.Entity
{
   public class Asset
    {
        [Key]
        public int Id { get; set; }
        [Required(ErrorMessage ="资产名称不为空")]
        public string Name { get; set; }
        [Required(ErrorMessage ="资产类型不能为空")]
        public int AssetClassId { get; set; }
        [NotMapped]
        public string AssetClassName { get; set; }
        [Required(ErrorMessage ="所属公司不能为空")]
        public int CompanyId { get; set; }
        [NotMapped]
        public string CompanyName { get; set; }
        [NotMapped]
        public int Number { get; set; }
        [Required(ErrorMessage ="采购人不为空")]
        public int BuyerId { get; set; }
        [NotMapped]
        public string BuyerName { get; set; }
        [Required(ErrorMessage ="时间不能为空")]
        //[RegularExpression(@"([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8])))", ErrorMessage = "只能输入正数")]
        public DateTime BuyTime { get; set; }
        [Required(ErrorMessage ="接收人不能为空")]
        public int Recipient { get; set; }
        [NotMapped]
        public string RecipientName { get; set; }
        public DateTime UploadTime { get; set; }
        /// <summary>
        /// 资产编码
        /// </summary>
        public string Code { get; set; }
        /// <summary>
        /// 接收地
        /// </summary>
        public string CalculatedGround{ get; set; }
        /// <summary>
        /// 供应商
        /// </summary>
        public string Supplier { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
        /// <summary>
        /// 状态
        /// 0、库存
        /// 1、使用中
        /// 2、报废
        /// </summary>
        public int Status{ get; set; }
        [NotMapped]
        public string StatusName { get; set; }
        /// <summary>
        /// 状态变更时间
        /// </summary>
        public DateTime StatusTime { get; set; }
        public DateTime? ScrapTime { get; set; }
        /// <summary>
        /// 入库回收备注
        /// </summary>
        public string RecoveryRemark { get; set; }
        /// <summary>
        /// 出库备注
        /// </summary>
        public string DistributionRemark { get; set; }
        /// <summary>
        /// 报废备注
        /// </summary>
        public string ScrapRemark{ get; set; }
        ///// <summary>
        ///// 服务器用途
        ///// </summary>
        //public int? serverPurposeId { get; set; }
        //[NotMapped]
        //public string serverPurposeName { get; set; }
        ///// <summary>
        ///// 服务器用途类别
        ///// </summary>
        //public int? serverPurposeSubId { get; set; }
        //[NotMapped]
        //public string serverPurposeSubName { get; set; }
        public int? UserId { get; set; }
        [NotMapped]
        public string UserName { get; set; }
        [NotMapped]
        public int UseCount { get; set; }
        /// <summary>
        ///专用于服务器资产标识
        /// </summary>
        [NotMapped]
        public string Identitys { get; set; }
        /// <summary>
        /// 0为未完善信息，不可入库
        /// 1为已完善信息，可入库
        /// </summary>
        [NotMapped]
        public int IsStorage { get; set; }
        [NotMapped]
        public List<ConsumateInfo> consumateInfo { get; set; }
    }
}
